package cn.iocoder.yudao.module.data.service.text2sql.pojo;

import com.google.common.base.Objects;
import lombok.*;
import org.apache.commons.collections4.MapUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SchemaElement implements Serializable {

    private Long dataSetId;
    private String dataSetName;
    private Long model;
    private Long id;
    private String name;
    private String bizName;
    private Long useCnt;
    private List<String> alias;
    private String defaultAgg;
    private String dataFormatType;

    private SchemaElementType type;
    private double order;
    private int isTag;
    private String description;
    @Builder.Default
    private Map<String, Object> extInfo = new HashMap<>();

    public String getTimeFormat() {
        if (MapUtils.isEmpty(extInfo)) {
            return null;
        }
        return (String) extInfo.get(DimensionConstants.DIMENSION_TIME_FORMAT);
    }


}
